# -*- coding: utf-8 -*-
# @Time : 2021/7/3 16:23
# @Author : liuha
# @File : java_script_exec.py
# @Project : ECshopGitee
from selenium.webdriver.common.by import By


class JavaScriptExec():
    def __init__(self,driver):
        self.driver = driver

    def js_scroll(self):
        xy = self.driver.find_element(By.TAG_NAME, 'html').size  # 获取窗口的宽高
        xy = "window.scroll(0,{})".format(xy["height"])  # js语句设定,滑动窗口
        self.driver.execute_script(xy)  # 执行js命令

